#pragma once

#include "../libs/httplib.h"
#include "../libs/easylog.h"
#include "../util.hpp"
#include "../controllers/alertcontroller.hpp"

namespace pharmacy_server
{
    struct AlertBusiness
    {
        static void check_stock_alerts(const httplib::Request& req, httplib::Response& rsp)
        {
            try
            {
                easylog::debug("checkStockAlerts");
                rsp.set_content(AlertController::instance().check_stock_alerts().serialize(), "application/json");
            }
            catch (const std::exception& e)
            {
                easylog::error("checkStockAlerts business error: {}", e.what());
            }
        }

        static void check_expiry(const httplib::Request& req, httplib::Response& rsp)
        {
            try
            {
                easylog::debug("checkExpiryDates");
                rsp.set_content(AlertController::instance().check_expiry().serialize(), "application/json");
            }
            catch (const std::exception& e)
            {
                easylog::error("checkExpiryDates business error: {}", e.what());
            }
        }
    };
}